package com.crud.generator.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import lombok.Data;

/**
 * 代码生成器配置类
 * 
 * @author CRUD-Generator
 */
@Configuration
@ConfigurationProperties(prefix = "generator")
@Data
public class GeneratorConfig {
    
    /**
     * 代码输出路径
     */
    private String outputPath = "generated-code";
    
    /**
     * 包名前缀
     */
    private String packagePrefix = "com.example";
    
    /**
     * 作者信息
     */
    private String author = "CRUD-Generator";
    
    /**
     * 项目版本
     */
    private String version = "1.0.0";
    
    /**
     * 最大文件大小（字节）
     */
    private long maxFileSize = 1024 * 1024; // 1MB
    
    /**
     * 是否启用代码预览
     */
    private boolean enablePreview = true;
    
    /**
     * 是否启用历史记录
     */
    private boolean enableHistory = true;
    
    /**
     * 支持的危险SQL关键字
     */
    private String[] dangerousKeywords = {
        "DROP", "DELETE", "TRUNCATE", "ALTER", "UPDATE"
    };
    
    /**
     * 模板配置
     */
    private Template template = new Template();
    
    @Data
    public static class Template {
        /**
         * 实体类模板路径
         */
        private String entityTemplate = "templates/code-templates/java/entity.ftl";
        
        /**
         * Mapper模板路径
         */
        private String mapperTemplate = "templates/code-templates/java/repository.ftl";
        
        /**
         * Service模板路径
         */
        private String serviceTemplate = "templates/code-templates/java/service.ftl";
        
        /**
         * Controller模板路径
         */
        private String controllerTemplate = "templates/code-templates/java/controller.ftl";
    }
}